﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace com.nm.library.Factorys {
    public class WalletFactory {
        private static IWallet _cache;
        private static Type _factoryType;

        public static IWallet Instance => _cache ?? (_cache = BaseFactory<IWallet, TestIWallet>.GetService(FactoryType));

        /// <summary>
        /// 实现此工程的实例类型
        /// </summary>
        public static Type FactoryType {
            get { return _factoryType; }
            set {
                if (_factoryType != value)
                    _cache = null;
                _factoryType = value;

            }
        }
    }

    public class TestIWallet : IWallet{
        public int AddBalanceLog(int cusId, decimal amount, string docNo)
        {
            throw new NotImplementedException();
        }
    }
}

namespace com.nm.library
{
    public interface IWallet{
        int AddBalanceLog(int cusId, decimal amount, string docNo);
    }
}